﻿using Newtonsoft.Json;

namespace AutomationCommand
{
    public class wb_element_cut : BasiCommand
    {
        [JsonProperty("by_type")]
        public string ByType { get; set; }

        [JsonProperty("by_content")]
        public string ByContent { get; set; }

        [JsonProperty("option")]
        public Option Option { get; set; }

        [JsonProperty("ala")]
        public string Ala { get; set; }

        [JsonProperty("pic_path")]
        public string PicPath { get; set; }

        public wb_element_cut()
        {
            FunctionType = "wb_element_cut";
            OtherName = "元素截图";
            ByType = "";
            ByContent = "";
            Option = new CutOption
            {
                Browse = new Browse
                {
                    Count = "10",
                    Lenth = "100"
                },
                Get = "cut"
            };
            Ala = "true";
            PicPath = "";
            SuccessJump = -1;
            FailureJump = -1;
        }

        public bool Execute()
        {
            // 在这里编写执行命令的逻辑
            // 返回执行结果
            return true; // 假设此处始终成功
        }
    }

    public class CutOption: Option
    {
        [JsonProperty("browse")]
        public Browse Browse { get; set; }

        [JsonProperty("get")]
        public string Get { get; set; }
    }

    public class Browse
    {
        [JsonProperty("count")]
        public string Count { get; set; }

        [JsonProperty("lenth")]
        public string Lenth { get; set; }
    }
}
